﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;

namespace FGrubert.CrmQueueMonitor.WinForms.InfoMonitor
{
    /// <summary>
    /// Represents an information item to show on the screen
    /// </summary>
    [Serializable]
    public class InfoItem
    {
        private string _websiteUrl;
        /// <summary>
        /// Url to a website to show in the window
        /// </summary>
        public string WebsiteUrl
        {
            get { return _websiteUrl; }
            set { _websiteUrl = value; }
        }

        /// <summary>
        /// Create a deep copy of this object
        /// </summary>
        /// <returns>A deep copy of this object</returns>
        public InfoItem DeepCopy()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(ms, this);
                ms.Position = 0;
                return (InfoItem)formatter.Deserialize(ms);
            }
        }
    }
}
